import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder } from '@angular/forms';

@Component({
  selector: 'task-register',
  templateUrl: './register.component.html',
  styleUrls: ['./register.component.scss']
})
export class RegisterComponent implements OnInit {
  form:FormGroup;
  items: string[];
  private readonly avatorName = 'avators';
  constructor(private fb:FormBuilder) { }

  ngOnInit() {
    const img = `${this.avatorName}:svg-${Math.floor(Math.random()*15).toFixed(0)}`;
    const nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
    this.items = nums.map(d => `avators:svg-${d}`);
    this.form = this.fb.group({
      email:[],
      name:[],
      password:[],
      repeat:[],
      avator:[img]
    });
  }
  onSubmit({value,valid},ev:Event){}
}
